{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## df_area"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>continentName</th>\n",
       "      <th>continentEnglishName</th>\n",
       "      <th>countryName</th>\n",
       "      <th>countryEnglishName</th>\n",
       "      <th>provinceName</th>\n",
       "      <th>provinceEnglishName</th>\n",
       "      <th>province_zipCode</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_suspectedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>province_deadCount</th>\n",
       "      <th>updateTime</th>\n",
       "      <th>cityName</th>\n",
       "      <th>cityEnglishName</th>\n",
       "      <th>city_zipCode</th>\n",
       "      <th>city_confirmedCount</th>\n",
       "      <th>city_suspectedCount</th>\n",
       "      <th>city_curedCount</th>\n",
       "      <th>city_deadCount</th>\n",
       "      <th>date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>香港</td>\n",
       "      <td>Hong Kong</td>\n",
       "      <td>810000</td>\n",
       "      <td>1035</td>\n",
       "      <td>47.0</td>\n",
       "      <td>699</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-04-23 18:54:47</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>澳门</td>\n",
       "      <td>Macau</td>\n",
       "      <td>820000</td>\n",
       "      <td>45</td>\n",
       "      <td>9.0</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>2020-04-23 18:54:47</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>951001</td>\n",
       "      <td>84304</td>\n",
       "      <td>0.0</td>\n",
       "      <td>78169</td>\n",
       "      <td>4642</td>\n",
       "      <td>2020-04-23 18:54:47</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>北美洲</td>\n",
       "      <td>North America</td>\n",
       "      <td>美国</td>\n",
       "      <td>United States of America</td>\n",
       "      <td>美国</td>\n",
       "      <td>United States of America</td>\n",
       "      <td>971002</td>\n",
       "      <td>842624</td>\n",
       "      <td>0.0</td>\n",
       "      <td>76614</td>\n",
       "      <td>46785</td>\n",
       "      <td>2020-04-23 18:44:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>欧洲</td>\n",
       "      <td>Europe</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>Spain</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>Spain</td>\n",
       "      <td>965015</td>\n",
       "      <td>213024</td>\n",
       "      <td>0.0</td>\n",
       "      <td>89250</td>\n",
       "      <td>22157</td>\n",
       "      <td>2020-04-23 18:44:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148361</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>辽宁省</td>\n",
       "      <td>Liaoning</td>\n",
       "      <td>210000</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22 03:28:10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148362</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>台湾</td>\n",
       "      <td>Taiwan</td>\n",
       "      <td>710000</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22 03:28:10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148363</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>Hongkong</td>\n",
       "      <td>香港</td>\n",
       "      <td>Hongkong</td>\n",
       "      <td>810000</td>\n",
       "      <td>0</td>\n",
       "      <td>117.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22 03:28:10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148364</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>Heilongjiang</td>\n",
       "      <td>230000</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22 03:28:10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148365</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>湖南省</td>\n",
       "      <td>Hunan</td>\n",
       "      <td>430000</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22 03:28:10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>148366 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       continentName continentEnglishName countryName  \\\n",
       "0                 亚洲                 Asia          中国   \n",
       "1                 亚洲                 Asia          中国   \n",
       "2                 亚洲                 Asia          中国   \n",
       "3                北美洲        North America          美国   \n",
       "4                 欧洲               Europe         西班牙   \n",
       "...              ...                  ...         ...   \n",
       "148361            亚洲                 Asia          中国   \n",
       "148362            亚洲                 Asia          中国   \n",
       "148363            亚洲                 Asia          中国   \n",
       "148364            亚洲                 Asia          中国   \n",
       "148365            亚洲                 Asia          中国   \n",
       "\n",
       "              countryEnglishName provinceName       provinceEnglishName  \\\n",
       "0                          China           香港                 Hong Kong   \n",
       "1                          China           澳门                     Macau   \n",
       "2                          China           中国                     China   \n",
       "3       United States of America           美国  United States of America   \n",
       "4                          Spain          西班牙                     Spain   \n",
       "...                          ...          ...                       ...   \n",
       "148361                     China          辽宁省                  Liaoning   \n",
       "148362                     China           台湾                    Taiwan   \n",
       "148363                  Hongkong           香港                  Hongkong   \n",
       "148364                     China         黑龙江省              Heilongjiang   \n",
       "148365                     China          湖南省                     Hunan   \n",
       "\n",
       "        province_zipCode  province_confirmedCount  province_suspectedCount  \\\n",
       "0                 810000                     1035                     47.0   \n",
       "1                 820000                       45                      9.0   \n",
       "2                 951001                    84304                      0.0   \n",
       "3                 971002                   842624                      0.0   \n",
       "4                 965015                   213024                      0.0   \n",
       "...                  ...                      ...                      ...   \n",
       "148361            210000                        0                      1.0   \n",
       "148362            710000                        1                      0.0   \n",
       "148363            810000                        0                    117.0   \n",
       "148364            230000                        0                      1.0   \n",
       "148365            430000                        1                      0.0   \n",
       "\n",
       "        province_curedCount  province_deadCount           updateTime cityName  \\\n",
       "0                       699                   4  2020-04-23 18:54:47      NaN   \n",
       "1                        27                   0  2020-04-23 18:54:47      NaN   \n",
       "2                     78169                4642  2020-04-23 18:54:47      NaN   \n",
       "3                     76614               46785  2020-04-23 18:44:40      NaN   \n",
       "4                     89250               22157  2020-04-23 18:44:40      NaN   \n",
       "...                     ...                 ...                  ...      ...   \n",
       "148361                    0                   0  2020-01-22 03:28:10      NaN   \n",
       "148362                    0                   0  2020-01-22 03:28:10      NaN   \n",
       "148363                    0                   0  2020-01-22 03:28:10      NaN   \n",
       "148364                    0                   0  2020-01-22 03:28:10      NaN   \n",
       "148365                    0                   0  2020-01-22 03:28:10      NaN   \n",
       "\n",
       "       cityEnglishName  city_zipCode  city_confirmedCount  \\\n",
       "0                  NaN           NaN                  NaN   \n",
       "1                  NaN           NaN                  NaN   \n",
       "2                  NaN           NaN                  NaN   \n",
       "3                  NaN           NaN                  NaN   \n",
       "4                  NaN           NaN                  NaN   \n",
       "...                ...           ...                  ...   \n",
       "148361             NaN           NaN                  NaN   \n",
       "148362             NaN           NaN                  NaN   \n",
       "148363             NaN           NaN                  NaN   \n",
       "148364             NaN           NaN                  NaN   \n",
       "148365             NaN           NaN                  NaN   \n",
       "\n",
       "        city_suspectedCount  city_curedCount  city_deadCount        date  \n",
       "0                       NaN              NaN             NaN  2020-04-23  \n",
       "1                       NaN              NaN             NaN  2020-04-23  \n",
       "2                       NaN              NaN             NaN  2020-04-23  \n",
       "3                       NaN              NaN             NaN  2020-04-23  \n",
       "4                       NaN              NaN             NaN  2020-04-23  \n",
       "...                     ...              ...             ...         ...  \n",
       "148361                  NaN              NaN             NaN  2020-01-22  \n",
       "148362                  NaN              NaN             NaN  2020-01-22  \n",
       "148363                  NaN              NaN             NaN  2020-01-22  \n",
       "148364                  NaN              NaN             NaN  2020-01-22  \n",
       "148365                  NaN              NaN             NaN  2020-01-22  \n",
       "\n",
       "[148366 rows x 20 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# github仓库地址\n",
    "# df_area = pd.read_csv('https://raw.githubusercontent.com/BlankerL/DXY-COVID-19-Data/master/csv/DXYArea.csv')\n",
    "# gitee上对应的镜像仓库，不可用\n",
    "df_area = pd.read_csv('https://gitee.com/Mr_Wr0ng/DXY-COVID-19-Data/raw/master/csv/DXYArea.csv')\n",
    "# df_area = pd.read_csv('G:\\Gitclone\\DXY-COVID-19-Data\\csv\\DXYArea.csv')\n",
    "df_area['date'] = df_area['updateTime'].apply(lambda x: x[:10])\n",
    "df_area"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## df_area_simple"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### func drop_duplicate_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def drop_duplicates_data(target_date):\n",
    "    df_day = df_area[df_area['date'] == target_date]\n",
    "#     return df_day.drop_duplicates(['countryName', 'provinceName']).sort_values(by=column, ascending=False)\n",
    "    return df_day.drop_duplicates(['countryName', 'provinceName'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### df_area_simple"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>continentName</th>\n",
       "      <th>continentEnglishName</th>\n",
       "      <th>countryName</th>\n",
       "      <th>countryEnglishName</th>\n",
       "      <th>provinceName</th>\n",
       "      <th>provinceEnglishName</th>\n",
       "      <th>province_zipCode</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_suspectedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>...</th>\n",
       "      <th>cityName</th>\n",
       "      <th>cityEnglishName</th>\n",
       "      <th>city_zipCode</th>\n",
       "      <th>city_confirmedCount</th>\n",
       "      <th>city_suspectedCount</th>\n",
       "      <th>city_curedCount</th>\n",
       "      <th>city_deadCount</th>\n",
       "      <th>date</th>\n",
       "      <th>province_nowconfirmedCount</th>\n",
       "      <th>city_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>148308</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>河北省</td>\n",
       "      <td>Hebei</td>\n",
       "      <td>130000</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148309</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>湖北省</td>\n",
       "      <td>Hubei</td>\n",
       "      <td>420000</td>\n",
       "      <td>444</td>\n",
       "      <td>NaN</td>\n",
       "      <td>28</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>399</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148311</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>山东省</td>\n",
       "      <td>Shandong</td>\n",
       "      <td>370000</td>\n",
       "      <td>2</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148312</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>Guangxi</td>\n",
       "      <td>450000</td>\n",
       "      <td>2</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148313</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>河南省</td>\n",
       "      <td>Henan</td>\n",
       "      <td>410000</td>\n",
       "      <td>5</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>426</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>北京市</td>\n",
       "      <td>Beijing</td>\n",
       "      <td>110000</td>\n",
       "      <td>593</td>\n",
       "      <td>164.0</td>\n",
       "      <td>522</td>\n",
       "      <td>...</td>\n",
       "      <td>朝阳区</td>\n",
       "      <td>Chaoyang District</td>\n",
       "      <td>110105.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>63</td>\n",
       "      <td>75.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>444</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>广东省</td>\n",
       "      <td>Guangdong</td>\n",
       "      <td>440000</td>\n",
       "      <td>1584</td>\n",
       "      <td>11.0</td>\n",
       "      <td>1518</td>\n",
       "      <td>...</td>\n",
       "      <td>广州</td>\n",
       "      <td>Guangzhou</td>\n",
       "      <td>440100.0</td>\n",
       "      <td>501.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>472.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>58</td>\n",
       "      <td>28.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>465</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>山西省</td>\n",
       "      <td>Shanxi</td>\n",
       "      <td>140000</td>\n",
       "      <td>197</td>\n",
       "      <td>18.0</td>\n",
       "      <td>142</td>\n",
       "      <td>...</td>\n",
       "      <td>境外输入</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>55</td>\n",
       "      <td>55.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>477</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>吉林省</td>\n",
       "      <td>Jilin</td>\n",
       "      <td>220000</td>\n",
       "      <td>107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>98</td>\n",
       "      <td>...</td>\n",
       "      <td>吉林市</td>\n",
       "      <td>Jilin</td>\n",
       "      <td>220200.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>8</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>487</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>四川省</td>\n",
       "      <td>Sichuan</td>\n",
       "      <td>510000</td>\n",
       "      <td>561</td>\n",
       "      <td>13.0</td>\n",
       "      <td>557</td>\n",
       "      <td>...</td>\n",
       "      <td>成都</td>\n",
       "      <td>Chengdu</td>\n",
       "      <td>510100.0</td>\n",
       "      <td>166.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>162.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>1</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>11639 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       continentName continentEnglishName countryName countryEnglishName  \\\n",
       "148308            亚洲                 Asia          中国              China   \n",
       "148309            亚洲                 Asia          中国              China   \n",
       "148311            亚洲                 Asia          中国              China   \n",
       "148312            亚洲                 Asia          中国              China   \n",
       "148313            亚洲                 Asia          中国              China   \n",
       "...              ...                  ...         ...                ...   \n",
       "426               亚洲                 Asia          中国              China   \n",
       "444               亚洲                 Asia          中国              China   \n",
       "465               亚洲                 Asia          中国              China   \n",
       "477               亚洲                 Asia          中国              China   \n",
       "487               亚洲                 Asia          中国              China   \n",
       "\n",
       "       provinceName provinceEnglishName  province_zipCode  \\\n",
       "148308          河北省               Hebei            130000   \n",
       "148309          湖北省               Hubei            420000   \n",
       "148311          山东省            Shandong            370000   \n",
       "148312      广西壮族自治区             Guangxi            450000   \n",
       "148313          河南省               Henan            410000   \n",
       "...             ...                 ...               ...   \n",
       "426             北京市             Beijing            110000   \n",
       "444             广东省           Guangdong            440000   \n",
       "465             山西省              Shanxi            140000   \n",
       "477             吉林省               Jilin            220000   \n",
       "487             四川省             Sichuan            510000   \n",
       "\n",
       "        province_confirmedCount  province_suspectedCount  province_curedCount  \\\n",
       "148308                        1                      0.0                    0   \n",
       "148309                      444                      NaN                   28   \n",
       "148311                        2                      0.0                    0   \n",
       "148312                        2                      1.0                    0   \n",
       "148313                        5                      0.0                    0   \n",
       "...                         ...                      ...                  ...   \n",
       "426                         593                    164.0                  522   \n",
       "444                        1584                     11.0                 1518   \n",
       "465                         197                     18.0                  142   \n",
       "477                         107                      3.0                   98   \n",
       "487                         561                     13.0                  557   \n",
       "\n",
       "        ...  cityName    cityEnglishName city_zipCode city_confirmedCount  \\\n",
       "148308  ...       NaN                NaN          NaN                 NaN   \n",
       "148309  ...       NaN                NaN          NaN                 NaN   \n",
       "148311  ...       NaN                NaN          NaN                 NaN   \n",
       "148312  ...       NaN                NaN          NaN                 NaN   \n",
       "148313  ...       NaN                NaN          NaN                 NaN   \n",
       "...     ...       ...                ...          ...                 ...   \n",
       "426     ...       朝阳区  Chaoyang District     110105.0                75.0   \n",
       "444     ...        广州          Guangzhou     440100.0               501.0   \n",
       "465     ...      境外输入                NaN          0.0                64.0   \n",
       "477     ...       吉林市              Jilin     220200.0                13.0   \n",
       "487     ...        成都            Chengdu     510100.0               166.0   \n",
       "\n",
       "        city_suspectedCount  city_curedCount  city_deadCount        date  \\\n",
       "148308                  NaN              NaN             NaN  2020-01-22   \n",
       "148309                  NaN              NaN             NaN  2020-01-22   \n",
       "148311                  NaN              NaN             NaN  2020-01-22   \n",
       "148312                  NaN              NaN             NaN  2020-01-22   \n",
       "148313                  NaN              NaN             NaN  2020-01-22   \n",
       "...                     ...              ...             ...         ...   \n",
       "426                     0.0              0.0             0.0  2020-04-23   \n",
       "444                     4.0            472.0             1.0  2020-04-23   \n",
       "465                    18.0              9.0             0.0  2020-04-23   \n",
       "477                     1.0              6.0             0.0  2020-04-23   \n",
       "487                    13.0            162.0             3.0  2020-04-23   \n",
       "\n",
       "        province_nowconfirmedCount city_nowconfirmedCount  \n",
       "148308                           1                    NaN  \n",
       "148309                         399                    NaN  \n",
       "148311                           2                    NaN  \n",
       "148312                           2                    NaN  \n",
       "148313                           5                    NaN  \n",
       "...                            ...                    ...  \n",
       "426                             63                   75.0  \n",
       "444                             58                   28.0  \n",
       "465                             55                   55.0  \n",
       "477                              8                    7.0  \n",
       "487                              1                    1.0  \n",
       "\n",
       "[11639 rows x 22 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_day_all = [drop_duplicates_data(target_date=d) for d in df_area['date'].unique()]\n",
    "df_area_simple_t = pd.concat(df_day_all[::-1])\n",
    "df_area_simple_t['province_nowconfirmedCount'] = df_area_simple_t['province_confirmedCount'] - df_area_simple_t['province_curedCount'] - df_area_simple_t['province_deadCount']\n",
    "df_area_simple_t['city_nowconfirmedCount'] = df_area_simple_t['city_confirmedCount'] - df_area_simple_t['city_curedCount'] - df_area_simple_t['city_deadCount']\n",
    "df_area_simple = df_area_simple_t[(df_area_simple_t['countryName'] != '大不列颠及北爱尔兰联合王国') & (df_area_simple_t['countryName'] != '英国（含北爱尔兰）')]\n",
    "df_area_simple"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### df_foreign"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>continentName</th>\n",
       "      <th>continentEnglishName</th>\n",
       "      <th>countryName</th>\n",
       "      <th>countryEnglishName</th>\n",
       "      <th>provinceName</th>\n",
       "      <th>provinceEnglishName</th>\n",
       "      <th>province_zipCode</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_suspectedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>...</th>\n",
       "      <th>cityName</th>\n",
       "      <th>cityEnglishName</th>\n",
       "      <th>city_zipCode</th>\n",
       "      <th>city_confirmedCount</th>\n",
       "      <th>city_suspectedCount</th>\n",
       "      <th>city_curedCount</th>\n",
       "      <th>city_deadCount</th>\n",
       "      <th>date</th>\n",
       "      <th>province_nowconfirmedCount</th>\n",
       "      <th>city_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>144315</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>柬埔寨</td>\n",
       "      <td>Kampuchea (Cambodia )</td>\n",
       "      <td>柬埔寨</td>\n",
       "      <td>Kampuchea (Cambodia )</td>\n",
       "      <td>952003</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-27</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>144402</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>泰国</td>\n",
       "      <td>Thailand</td>\n",
       "      <td>泰国</td>\n",
       "      <td>Thailand</td>\n",
       "      <td>952010</td>\n",
       "      <td>7</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-27</td>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>144403</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>美国</td>\n",
       "      <td>United States of America</td>\n",
       "      <td>美国</td>\n",
       "      <td>United States of America</td>\n",
       "      <td>971002</td>\n",
       "      <td>5</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-27</td>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>144404</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>澳大利亚</td>\n",
       "      <td>Australia</td>\n",
       "      <td>澳大利亚</td>\n",
       "      <td>Australia</td>\n",
       "      <td>990001</td>\n",
       "      <td>5</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-27</td>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>144405</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>新加坡</td>\n",
       "      <td>Singapore</td>\n",
       "      <td>新加坡</td>\n",
       "      <td>Singapore</td>\n",
       "      <td>952009</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-27</td>\n",
       "      <td>4</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>172</td>\n",
       "      <td>非洲</td>\n",
       "      <td>Africa</td>\n",
       "      <td>津巴布韦</td>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>津巴布韦</td>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>984013</td>\n",
       "      <td>28</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>22</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>173</td>\n",
       "      <td>非洲</td>\n",
       "      <td>Africa</td>\n",
       "      <td>马拉维</td>\n",
       "      <td>Malawi</td>\n",
       "      <td>马拉维</td>\n",
       "      <td>Malawi</td>\n",
       "      <td>984006</td>\n",
       "      <td>23</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>18</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>174</td>\n",
       "      <td>北美洲</td>\n",
       "      <td>North America</td>\n",
       "      <td>尼加拉瓜</td>\n",
       "      <td>Nicaragua</td>\n",
       "      <td>尼加拉瓜</td>\n",
       "      <td>Nicaragua</td>\n",
       "      <td>972006</td>\n",
       "      <td>10</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>8</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>175</td>\n",
       "      <td>非洲</td>\n",
       "      <td>Africa</td>\n",
       "      <td>中非共和国</td>\n",
       "      <td>Central African Republic</td>\n",
       "      <td>中非共和国</td>\n",
       "      <td>Central African Republic</td>\n",
       "      <td>983002</td>\n",
       "      <td>16</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>6</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>176</td>\n",
       "      <td>南美洲</td>\n",
       "      <td>South America</td>\n",
       "      <td>苏里南</td>\n",
       "      <td>Suriname</td>\n",
       "      <td>苏里南</td>\n",
       "      <td>Suriname</td>\n",
       "      <td>973010</td>\n",
       "      <td>10</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>9428 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       continentName continentEnglishName countryName  \\\n",
       "144315           NaN                  NaN         柬埔寨   \n",
       "144402           NaN                  NaN          泰国   \n",
       "144403           NaN                  NaN          美国   \n",
       "144404           NaN                  NaN        澳大利亚   \n",
       "144405           NaN                  NaN         新加坡   \n",
       "...              ...                  ...         ...   \n",
       "172               非洲               Africa        津巴布韦   \n",
       "173               非洲               Africa         马拉维   \n",
       "174              北美洲        North America        尼加拉瓜   \n",
       "175               非洲               Africa       中非共和国   \n",
       "176              南美洲        South America         苏里南   \n",
       "\n",
       "              countryEnglishName provinceName       provinceEnglishName  \\\n",
       "144315     Kampuchea (Cambodia )          柬埔寨     Kampuchea (Cambodia )   \n",
       "144402                  Thailand           泰国                  Thailand   \n",
       "144403  United States of America           美国  United States of America   \n",
       "144404                 Australia         澳大利亚                 Australia   \n",
       "144405                 Singapore          新加坡                 Singapore   \n",
       "...                          ...          ...                       ...   \n",
       "172                     Zimbabwe         津巴布韦                  Zimbabwe   \n",
       "173                       Malawi          马拉维                    Malawi   \n",
       "174                    Nicaragua         尼加拉瓜                 Nicaragua   \n",
       "175     Central African Republic        中非共和国  Central African Republic   \n",
       "176                     Suriname          苏里南                  Suriname   \n",
       "\n",
       "        province_zipCode  province_confirmedCount  province_suspectedCount  \\\n",
       "144315            952003                        1                      0.0   \n",
       "144402            952010                        7                      0.0   \n",
       "144403            971002                        5                      0.0   \n",
       "144404            990001                        5                      0.0   \n",
       "144405            952009                        4                      0.0   \n",
       "...                  ...                      ...                      ...   \n",
       "172               984013                       28                      0.0   \n",
       "173               984006                       23                      0.0   \n",
       "174               972006                       10                      0.0   \n",
       "175               983002                       16                      0.0   \n",
       "176               973010                       10                      0.0   \n",
       "\n",
       "        province_curedCount  ...  cityName cityEnglishName city_zipCode  \\\n",
       "144315                    0  ...       NaN             NaN          NaN   \n",
       "144402                    2  ...       NaN             NaN          NaN   \n",
       "144403                    0  ...       NaN             NaN          NaN   \n",
       "144404                    0  ...       NaN             NaN          NaN   \n",
       "144405                    0  ...       NaN             NaN          NaN   \n",
       "...                     ...  ...       ...             ...          ...   \n",
       "172                       2  ...       NaN             NaN          NaN   \n",
       "173                       3  ...       NaN             NaN          NaN   \n",
       "174                       0  ...       NaN             NaN          NaN   \n",
       "175                      10  ...       NaN             NaN          NaN   \n",
       "176                       6  ...       NaN             NaN          NaN   \n",
       "\n",
       "       city_confirmedCount  city_suspectedCount  city_curedCount  \\\n",
       "144315                 NaN                  NaN              NaN   \n",
       "144402                 NaN                  NaN              NaN   \n",
       "144403                 NaN                  NaN              NaN   \n",
       "144404                 NaN                  NaN              NaN   \n",
       "144405                 NaN                  NaN              NaN   \n",
       "...                    ...                  ...              ...   \n",
       "172                    NaN                  NaN              NaN   \n",
       "173                    NaN                  NaN              NaN   \n",
       "174                    NaN                  NaN              NaN   \n",
       "175                    NaN                  NaN              NaN   \n",
       "176                    NaN                  NaN              NaN   \n",
       "\n",
       "        city_deadCount        date  province_nowconfirmedCount  \\\n",
       "144315             NaN  2020-01-27                           1   \n",
       "144402             NaN  2020-01-27                           5   \n",
       "144403             NaN  2020-01-27                           5   \n",
       "144404             NaN  2020-01-27                           5   \n",
       "144405             NaN  2020-01-27                           4   \n",
       "...                ...         ...                         ...   \n",
       "172                NaN  2020-04-23                          22   \n",
       "173                NaN  2020-04-23                          18   \n",
       "174                NaN  2020-04-23                           8   \n",
       "175                NaN  2020-04-23                           6   \n",
       "176                NaN  2020-04-23                           3   \n",
       "\n",
       "       city_nowconfirmedCount  \n",
       "144315                    NaN  \n",
       "144402                    NaN  \n",
       "144403                    NaN  \n",
       "144404                    NaN  \n",
       "144405                    NaN  \n",
       "...                       ...  \n",
       "172                       NaN  \n",
       "173                       NaN  \n",
       "174                       NaN  \n",
       "175                       NaN  \n",
       "176                       NaN  \n",
       "\n",
       "[9428 rows x 22 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_foreign = df_area_simple[df_area_simple['countryName'] != '中国']\n",
    "df_foreign"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### dff_forergn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>countType</th>\n",
       "      <th colspan=\"10\" halign=\"left\">province_confirmedCount</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">province_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>countryName</th>\n",
       "      <th>不丹</th>\n",
       "      <th>东帝汶</th>\n",
       "      <th>中非共和国</th>\n",
       "      <th>丹麦</th>\n",
       "      <th>乌克兰</th>\n",
       "      <th>乌兹别克斯坦</th>\n",
       "      <th>乌干达</th>\n",
       "      <th>乌拉圭</th>\n",
       "      <th>乍得</th>\n",
       "      <th>也门共和国</th>\n",
       "      <th>...</th>\n",
       "      <th>马恩岛</th>\n",
       "      <th>马拉维</th>\n",
       "      <th>马提尼克</th>\n",
       "      <th>马来西亚</th>\n",
       "      <th>马约特</th>\n",
       "      <th>马耳他</th>\n",
       "      <th>马达加斯加</th>\n",
       "      <th>马里</th>\n",
       "      <th>黎巴嫩</th>\n",
       "      <th>黑山</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-27</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-28</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-29</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-31</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>5.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>7242.0</td>\n",
       "      <td>5449.0</td>\n",
       "      <td>1495.0</td>\n",
       "      <td>55.0</td>\n",
       "      <td>517.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>285.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>151.0</td>\n",
       "      <td>2103.0</td>\n",
       "      <td>241.0</td>\n",
       "      <td>375.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>162.0</td>\n",
       "      <td>553.0</td>\n",
       "      <td>245.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>5.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>7384.0</td>\n",
       "      <td>5710.0</td>\n",
       "      <td>1543.0</td>\n",
       "      <td>55.0</td>\n",
       "      <td>528.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>287.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>151.0</td>\n",
       "      <td>2041.0</td>\n",
       "      <td>241.0</td>\n",
       "      <td>379.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>168.0</td>\n",
       "      <td>554.0</td>\n",
       "      <td>248.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>5.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>7515.0</td>\n",
       "      <td>6125.0</td>\n",
       "      <td>1565.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>535.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>293.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>151.0</td>\n",
       "      <td>2041.0</td>\n",
       "      <td>280.0</td>\n",
       "      <td>380.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>176.0</td>\n",
       "      <td>553.0</td>\n",
       "      <td>219.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>6.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>7695.0</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1657.0</td>\n",
       "      <td>58.0</td>\n",
       "      <td>543.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>293.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1987.0</td>\n",
       "      <td>280.0</td>\n",
       "      <td>384.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>187.0</td>\n",
       "      <td>552.0</td>\n",
       "      <td>207.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>6.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>7912.0</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1657.0</td>\n",
       "      <td>63.0</td>\n",
       "      <td>549.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>297.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1987.0</td>\n",
       "      <td>307.0</td>\n",
       "      <td>396.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>187.0</td>\n",
       "      <td>552.0</td>\n",
       "      <td>194.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>88 rows × 864 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countType   province_confirmedCount                                            \\\n",
       "countryName                      不丹   东帝汶 中非共和国      丹麦     乌克兰  乌兹别克斯坦   乌干达   \n",
       "date                                                                            \n",
       "2020-01-27                      0.0   0.0   0.0     0.0     0.0     0.0   0.0   \n",
       "2020-01-28                      0.0   0.0   0.0     0.0     0.0     0.0   0.0   \n",
       "2020-01-29                      0.0   0.0   0.0     0.0     0.0     0.0   0.0   \n",
       "2020-01-30                      0.0   0.0   0.0     0.0     0.0     0.0   0.0   \n",
       "2020-01-31                      0.0   0.0   0.0     0.0     0.0     0.0   0.0   \n",
       "...                             ...   ...   ...     ...     ...     ...   ...   \n",
       "2020-04-19                      5.0  18.0  12.0  7242.0  5449.0  1495.0  55.0   \n",
       "2020-04-20                      5.0  19.0  12.0  7384.0  5710.0  1543.0  55.0   \n",
       "2020-04-21                      5.0  19.0  14.0  7515.0  6125.0  1565.0  56.0   \n",
       "2020-04-22                      6.0  23.0  14.0  7695.0  6592.0  1657.0  58.0   \n",
       "2020-04-23                      6.0  23.0  16.0  7912.0  6592.0  1657.0  63.0   \n",
       "\n",
       "countType                       ... province_nowconfirmedCount               \\\n",
       "countryName    乌拉圭    乍得 也门共和国  ...                        马恩岛   马拉维   马提尼克   \n",
       "date                            ...                                           \n",
       "2020-01-27     0.0   0.0   0.0  ...                        0.0   0.0    0.0   \n",
       "2020-01-28     0.0   0.0   0.0  ...                        0.0   0.0    0.0   \n",
       "2020-01-29     0.0   0.0   0.0  ...                        0.0   0.0    0.0   \n",
       "2020-01-30     0.0   0.0   0.0  ...                        0.0   0.0    0.0   \n",
       "2020-01-31     0.0   0.0   0.0  ...                        0.0   0.0    0.0   \n",
       "...            ...   ...   ...  ...                        ...   ...    ...   \n",
       "2020-04-19   517.0  33.0   1.0  ...                      285.0  15.0  151.0   \n",
       "2020-04-20   528.0  33.0   1.0  ...                      287.0  15.0  151.0   \n",
       "2020-04-21   535.0  33.0   1.0  ...                      293.0  15.0  151.0   \n",
       "2020-04-22   543.0  33.0   1.0  ...                      293.0  18.0  149.0   \n",
       "2020-04-23   549.0  34.0   1.0  ...                      297.0  18.0  149.0   \n",
       "\n",
       "countType                                                     \n",
       "countryName    马来西亚    马约特    马耳他 马达加斯加     马里    黎巴嫩     黑山  \n",
       "date                                                          \n",
       "2020-01-27      3.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-28      3.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-29      7.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-30      8.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-31      8.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "...             ...    ...    ...   ...    ...    ...    ...  \n",
       "2020-04-19   2103.0  241.0  375.0  85.0  162.0  553.0  245.0  \n",
       "2020-04-20   2041.0  241.0  379.0  85.0  168.0  554.0  248.0  \n",
       "2020-04-21   2041.0  280.0  380.0  86.0  176.0  553.0  219.0  \n",
       "2020-04-22   1987.0  280.0  384.0  86.0  187.0  552.0  207.0  \n",
       "2020-04-23   1987.0  307.0  396.0  86.0  187.0  552.0  194.0  \n",
       "\n",
       "[88 rows x 864 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dff_foreign = pd.pivot(data=df_foreign, index='date', columns='countryName', values=['province_confirmedCount',\n",
    "                                                                                     'province_curedCount',\n",
    "                                                                                     'province_deadCount', \n",
    "                                                                                    'province_nowconfirmedCount'])\n",
    "dff_foreign.iloc[0, :].fillna(0, inplace=True)\n",
    "dff_foreign.fillna(method='ffill', inplace=True)\n",
    "dff_foreign.columns.names = ['countType', 'countryName']\n",
    "dff_foreign"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### df_cn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "F:\\Anaconda\\lib\\site-packages\\ipykernel_launcher.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>continentName</th>\n",
       "      <th>continentEnglishName</th>\n",
       "      <th>countryName</th>\n",
       "      <th>countryEnglishName</th>\n",
       "      <th>provinceName</th>\n",
       "      <th>provinceEnglishName</th>\n",
       "      <th>province_zipCode</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_suspectedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>...</th>\n",
       "      <th>cityEnglishName</th>\n",
       "      <th>city_zipCode</th>\n",
       "      <th>city_confirmedCount</th>\n",
       "      <th>city_suspectedCount</th>\n",
       "      <th>city_curedCount</th>\n",
       "      <th>city_deadCount</th>\n",
       "      <th>date</th>\n",
       "      <th>province_nowconfirmedCount</th>\n",
       "      <th>city_nowconfirmedCount</th>\n",
       "      <th>provinceShortName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>148308</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>河北省</td>\n",
       "      <td>Hebei</td>\n",
       "      <td>130000</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>河北</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148309</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>湖北省</td>\n",
       "      <td>Hubei</td>\n",
       "      <td>420000</td>\n",
       "      <td>444</td>\n",
       "      <td>NaN</td>\n",
       "      <td>28</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>399</td>\n",
       "      <td>NaN</td>\n",
       "      <td>湖北</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148311</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>山东省</td>\n",
       "      <td>Shandong</td>\n",
       "      <td>370000</td>\n",
       "      <td>2</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>山东</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148312</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>Guangxi</td>\n",
       "      <td>450000</td>\n",
       "      <td>2</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>广西</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>148313</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>河南省</td>\n",
       "      <td>Henan</td>\n",
       "      <td>410000</td>\n",
       "      <td>5</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "      <td>河南</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>426</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>北京市</td>\n",
       "      <td>Beijing</td>\n",
       "      <td>110000</td>\n",
       "      <td>593</td>\n",
       "      <td>164.0</td>\n",
       "      <td>522</td>\n",
       "      <td>...</td>\n",
       "      <td>Chaoyang District</td>\n",
       "      <td>110105.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>63</td>\n",
       "      <td>75.0</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>444</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>广东省</td>\n",
       "      <td>Guangdong</td>\n",
       "      <td>440000</td>\n",
       "      <td>1584</td>\n",
       "      <td>11.0</td>\n",
       "      <td>1518</td>\n",
       "      <td>...</td>\n",
       "      <td>Guangzhou</td>\n",
       "      <td>440100.0</td>\n",
       "      <td>501.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>472.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>58</td>\n",
       "      <td>28.0</td>\n",
       "      <td>广东</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>465</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>山西省</td>\n",
       "      <td>Shanxi</td>\n",
       "      <td>140000</td>\n",
       "      <td>197</td>\n",
       "      <td>18.0</td>\n",
       "      <td>142</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>55</td>\n",
       "      <td>55.0</td>\n",
       "      <td>山西</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>477</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>吉林省</td>\n",
       "      <td>Jilin</td>\n",
       "      <td>220000</td>\n",
       "      <td>107</td>\n",
       "      <td>3.0</td>\n",
       "      <td>98</td>\n",
       "      <td>...</td>\n",
       "      <td>Jilin</td>\n",
       "      <td>220200.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>8</td>\n",
       "      <td>7.0</td>\n",
       "      <td>吉林</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>487</td>\n",
       "      <td>亚洲</td>\n",
       "      <td>Asia</td>\n",
       "      <td>中国</td>\n",
       "      <td>China</td>\n",
       "      <td>四川省</td>\n",
       "      <td>Sichuan</td>\n",
       "      <td>510000</td>\n",
       "      <td>561</td>\n",
       "      <td>13.0</td>\n",
       "      <td>557</td>\n",
       "      <td>...</td>\n",
       "      <td>Chengdu</td>\n",
       "      <td>510100.0</td>\n",
       "      <td>166.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>162.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>1</td>\n",
       "      <td>1.0</td>\n",
       "      <td>四川</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2171 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       continentName continentEnglishName countryName countryEnglishName  \\\n",
       "148308            亚洲                 Asia          中国              China   \n",
       "148309            亚洲                 Asia          中国              China   \n",
       "148311            亚洲                 Asia          中国              China   \n",
       "148312            亚洲                 Asia          中国              China   \n",
       "148313            亚洲                 Asia          中国              China   \n",
       "...              ...                  ...         ...                ...   \n",
       "426               亚洲                 Asia          中国              China   \n",
       "444               亚洲                 Asia          中国              China   \n",
       "465               亚洲                 Asia          中国              China   \n",
       "477               亚洲                 Asia          中国              China   \n",
       "487               亚洲                 Asia          中国              China   \n",
       "\n",
       "       provinceName provinceEnglishName  province_zipCode  \\\n",
       "148308          河北省               Hebei            130000   \n",
       "148309          湖北省               Hubei            420000   \n",
       "148311          山东省            Shandong            370000   \n",
       "148312      广西壮族自治区             Guangxi            450000   \n",
       "148313          河南省               Henan            410000   \n",
       "...             ...                 ...               ...   \n",
       "426             北京市             Beijing            110000   \n",
       "444             广东省           Guangdong            440000   \n",
       "465             山西省              Shanxi            140000   \n",
       "477             吉林省               Jilin            220000   \n",
       "487             四川省             Sichuan            510000   \n",
       "\n",
       "        province_confirmedCount  province_suspectedCount  province_curedCount  \\\n",
       "148308                        1                      0.0                    0   \n",
       "148309                      444                      NaN                   28   \n",
       "148311                        2                      0.0                    0   \n",
       "148312                        2                      1.0                    0   \n",
       "148313                        5                      0.0                    0   \n",
       "...                         ...                      ...                  ...   \n",
       "426                         593                    164.0                  522   \n",
       "444                        1584                     11.0                 1518   \n",
       "465                         197                     18.0                  142   \n",
       "477                         107                      3.0                   98   \n",
       "487                         561                     13.0                  557   \n",
       "\n",
       "        ...    cityEnglishName city_zipCode city_confirmedCount  \\\n",
       "148308  ...                NaN          NaN                 NaN   \n",
       "148309  ...                NaN          NaN                 NaN   \n",
       "148311  ...                NaN          NaN                 NaN   \n",
       "148312  ...                NaN          NaN                 NaN   \n",
       "148313  ...                NaN          NaN                 NaN   \n",
       "...     ...                ...          ...                 ...   \n",
       "426     ...  Chaoyang District     110105.0                75.0   \n",
       "444     ...          Guangzhou     440100.0               501.0   \n",
       "465     ...                NaN          0.0                64.0   \n",
       "477     ...              Jilin     220200.0                13.0   \n",
       "487     ...            Chengdu     510100.0               166.0   \n",
       "\n",
       "       city_suspectedCount  city_curedCount  city_deadCount        date  \\\n",
       "148308                 NaN              NaN             NaN  2020-01-22   \n",
       "148309                 NaN              NaN             NaN  2020-01-22   \n",
       "148311                 NaN              NaN             NaN  2020-01-22   \n",
       "148312                 NaN              NaN             NaN  2020-01-22   \n",
       "148313                 NaN              NaN             NaN  2020-01-22   \n",
       "...                    ...              ...             ...         ...   \n",
       "426                    0.0              0.0             0.0  2020-04-23   \n",
       "444                    4.0            472.0             1.0  2020-04-23   \n",
       "465                   18.0              9.0             0.0  2020-04-23   \n",
       "477                    1.0              6.0             0.0  2020-04-23   \n",
       "487                   13.0            162.0             3.0  2020-04-23   \n",
       "\n",
       "        province_nowconfirmedCount  city_nowconfirmedCount provinceShortName  \n",
       "148308                           1                     NaN                河北  \n",
       "148309                         399                     NaN                湖北  \n",
       "148311                           2                     NaN                山东  \n",
       "148312                           2                     NaN                广西  \n",
       "148313                           5                     NaN                河南  \n",
       "...                            ...                     ...               ...  \n",
       "426                             63                    75.0                北京  \n",
       "444                             58                    28.0                广东  \n",
       "465                             55                    55.0                山西  \n",
       "477                              8                     7.0                吉林  \n",
       "487                              1                     1.0                四川  \n",
       "\n",
       "[2171 rows x 23 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_cn = df_area_simple[(df_area_simple['countryName'] == '中国') & (df_area_simple['provinceName'] != '中国')]\n",
    "df_cn['provinceShortName'] = df_cn['provinceName'].apply(lambda x: re.sub('[市,省,自治区,壮族,回族,维吾尔]', '', x))\n",
    "df_cn"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### df_province"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>countType</th>\n",
       "      <th colspan=\"10\" halign=\"left\">province_confirmedCount</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">province_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>provinceShortName</th>\n",
       "      <th>上海</th>\n",
       "      <th>云南</th>\n",
       "      <th>内蒙古</th>\n",
       "      <th>北京</th>\n",
       "      <th>台湾</th>\n",
       "      <th>吉林</th>\n",
       "      <th>四川</th>\n",
       "      <th>天津</th>\n",
       "      <th>宁夏</th>\n",
       "      <th>安徽</th>\n",
       "      <th>...</th>\n",
       "      <th>甘肃</th>\n",
       "      <th>福建</th>\n",
       "      <th>西藏</th>\n",
       "      <th>贵州</th>\n",
       "      <th>辽宁</th>\n",
       "      <th>重庆</th>\n",
       "      <th>陕西</th>\n",
       "      <th>青海</th>\n",
       "      <th>香港</th>\n",
       "      <th>黑龙江</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>16.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>20.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-25</td>\n",
       "      <td>33.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>...</td>\n",
       "      <td>4.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>57.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>40.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>68.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>...</td>\n",
       "      <td>7.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>14.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>635.0</td>\n",
       "      <td>184.0</td>\n",
       "      <td>193.0</td>\n",
       "      <td>593.0</td>\n",
       "      <td>420.0</td>\n",
       "      <td>104.0</td>\n",
       "      <td>561.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>991.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>419.0</td>\n",
       "      <td>413.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>638.0</td>\n",
       "      <td>184.0</td>\n",
       "      <td>194.0</td>\n",
       "      <td>593.0</td>\n",
       "      <td>422.0</td>\n",
       "      <td>104.0</td>\n",
       "      <td>561.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>991.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>391.0</td>\n",
       "      <td>420.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>638.0</td>\n",
       "      <td>184.0</td>\n",
       "      <td>194.0</td>\n",
       "      <td>593.0</td>\n",
       "      <td>425.0</td>\n",
       "      <td>106.0</td>\n",
       "      <td>561.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>991.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>375.0</td>\n",
       "      <td>425.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>639.0</td>\n",
       "      <td>184.0</td>\n",
       "      <td>194.0</td>\n",
       "      <td>593.0</td>\n",
       "      <td>426.0</td>\n",
       "      <td>106.0</td>\n",
       "      <td>561.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>991.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>351.0</td>\n",
       "      <td>429.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>640.0</td>\n",
       "      <td>184.0</td>\n",
       "      <td>194.0</td>\n",
       "      <td>593.0</td>\n",
       "      <td>426.0</td>\n",
       "      <td>107.0</td>\n",
       "      <td>561.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>991.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>332.0</td>\n",
       "      <td>427.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 136 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countType         province_confirmedCount                                     \\\n",
       "provinceShortName                      上海     云南    内蒙古     北京     台湾     吉林   \n",
       "date                                                                           \n",
       "2020-01-22                            9.0    1.0    0.0   10.0    1.0    0.0   \n",
       "2020-01-23                           16.0    1.0    0.0   22.0    1.0    1.0   \n",
       "2020-01-24                           20.0    5.0    2.0   36.0    1.0    3.0   \n",
       "2020-01-25                           33.0   11.0    7.0   41.0    3.0    4.0   \n",
       "2020-01-26                           40.0   16.0    7.0   68.0    4.0    4.0   \n",
       "...                                   ...    ...    ...    ...    ...    ...   \n",
       "2020-04-19                          635.0  184.0  193.0  593.0  420.0  104.0   \n",
       "2020-04-20                          638.0  184.0  194.0  593.0  422.0  104.0   \n",
       "2020-04-21                          638.0  184.0  194.0  593.0  425.0  106.0   \n",
       "2020-04-22                          639.0  184.0  194.0  593.0  426.0  106.0   \n",
       "2020-04-23                          640.0  184.0  194.0  593.0  426.0  107.0   \n",
       "\n",
       "countType                                     ... province_nowconfirmedCount  \\\n",
       "provinceShortName     四川     天津    宁夏     安徽  ...                         甘肃   \n",
       "date                                          ...                              \n",
       "2020-01-22           5.0    4.0   1.0    1.0  ...                        0.0   \n",
       "2020-01-23           8.0    4.0   1.0    9.0  ...                        2.0   \n",
       "2020-01-24          15.0    8.0   2.0   15.0  ...                        2.0   \n",
       "2020-01-25          28.0   10.0   3.0   39.0  ...                        4.0   \n",
       "2020-01-26          44.0   14.0   4.0   60.0  ...                        7.0   \n",
       "...                  ...    ...   ...    ...  ...                        ...   \n",
       "2020-04-19         561.0  189.0  75.0  991.0  ...                        0.0   \n",
       "2020-04-20         561.0  189.0  75.0  991.0  ...                        0.0   \n",
       "2020-04-21         561.0  189.0  75.0  991.0  ...                        0.0   \n",
       "2020-04-22         561.0  189.0  75.0  991.0  ...                        0.0   \n",
       "2020-04-23         561.0  189.0  75.0  991.0  ...                        0.0   \n",
       "\n",
       "countType                                                               \n",
       "provinceShortName    福建   西藏   贵州    辽宁    重庆    陕西   青海     香港    黑龙江  \n",
       "date                                                                    \n",
       "2020-01-22          1.0  0.0  1.0   2.0   6.0   0.0  0.0    0.0    0.0  \n",
       "2020-01-23          5.0  0.0  3.0   3.0   9.0   3.0  0.0    2.0    2.0  \n",
       "2020-01-24         10.0  0.0  3.0   4.0  27.0   5.0  0.0    2.0    3.0  \n",
       "2020-01-25         18.0  0.0  4.0  16.0  57.0  15.0  1.0    5.0    8.0  \n",
       "2020-01-26         35.0  0.0  5.0  21.0  75.0  22.0  1.0    5.0   14.0  \n",
       "...                 ...  ...  ...   ...   ...   ...  ...    ...    ...  \n",
       "2020-04-19         15.0  0.0  0.0   2.0   3.0   1.0  0.0  419.0  413.0  \n",
       "2020-04-20         15.0  0.0  0.0   1.0   3.0   1.0  0.0  391.0  420.0  \n",
       "2020-04-21         13.0  0.0  0.0   1.0   3.0  21.0  0.0  375.0  425.0  \n",
       "2020-04-22         12.0  0.0  0.0   1.0   3.0  23.0  0.0  351.0  429.0  \n",
       "2020-04-23         12.0  0.0  0.0   1.0   3.0  23.0  0.0  332.0  427.0  \n",
       "\n",
       "[93 rows x 136 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_province = pd.pivot(data=df_cn, index='date', columns='provinceShortName', values=['province_confirmedCount', \n",
    "                                                                                 'province_curedCount',\n",
    "                                                                                 'province_deadCount', \n",
    "                                                                                'province_nowconfirmedCount'])\n",
    "df_province.iloc[0, :].fillna(0, inplace=True)\n",
    "df_province.fillna(method='ffill', inplace=True)\n",
    "df_province.columns.names = ['countType', 'provinceShortName']\n",
    "df_province"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "dff_province = df_province"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### dff_cn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>countType</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>province_deadCount</th>\n",
       "      <th>province_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>countryName</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>544.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>499.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>639.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>592.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>901.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>839.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-25</td>\n",
       "      <td>1377.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>1297.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>2076.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>1971.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>84225.0</td>\n",
       "      <td>77879.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1704.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>84239.0</td>\n",
       "      <td>77948.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1649.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>84278.0</td>\n",
       "      <td>78016.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1620.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>84294.0</td>\n",
       "      <td>78097.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1555.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>84304.0</td>\n",
       "      <td>78169.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1493.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countType   province_confirmedCount province_curedCount province_deadCount  \\\n",
       "countryName                      中国                  中国                 中国   \n",
       "date                                                                         \n",
       "2020-01-22                    544.0                28.0               17.0   \n",
       "2020-01-23                    639.0                30.0               17.0   \n",
       "2020-01-24                    901.0                36.0               26.0   \n",
       "2020-01-25                   1377.0                39.0               41.0   \n",
       "2020-01-26                   2076.0                49.0               56.0   \n",
       "...                             ...                 ...                ...   \n",
       "2020-04-19                  84225.0             77879.0             4642.0   \n",
       "2020-04-20                  84239.0             77948.0             4642.0   \n",
       "2020-04-21                  84278.0             78016.0             4642.0   \n",
       "2020-04-22                  84294.0             78097.0             4642.0   \n",
       "2020-04-23                  84304.0             78169.0             4642.0   \n",
       "\n",
       "countType   province_nowconfirmedCount  \n",
       "countryName                         中国  \n",
       "date                                    \n",
       "2020-01-22                       499.0  \n",
       "2020-01-23                       592.0  \n",
       "2020-01-24                       839.0  \n",
       "2020-01-25                      1297.0  \n",
       "2020-01-26                      1971.0  \n",
       "...                                ...  \n",
       "2020-04-19                      1704.0  \n",
       "2020-04-20                      1649.0  \n",
       "2020-04-21                      1620.0  \n",
       "2020-04-22                      1555.0  \n",
       "2020-04-23                      1493.0  \n",
       "\n",
       "[93 rows x 4 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def df_cn_count(column):\n",
    "    df = df_province[column]\n",
    "    return df.sum(axis=1)\n",
    "df_cn_columns = [['province_confirmedCount', 'province_curedCount', 'province_deadCount', 'province_nowconfirmedCount'], \n",
    "                 ['中国', '中国', '中国', '中国']]\n",
    "df_cn_sum = [df_cn_count(column=c) for c in df_cn_columns[0]]\n",
    "dff_cn = pd.concat(df_cn_sum, axis=1)\n",
    "dff_cn.columns = df_cn_columns\n",
    "dff_cn.columns.names = ['countType', 'countryName']\n",
    "dff_cn"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## df_world"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>countType</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>province_deadCount</th>\n",
       "      <th>province_nowconfirmedCount</th>\n",
       "      <th colspan=\"6\" halign=\"left\">province_confirmedCount</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">province_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>countryName</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>不丹</th>\n",
       "      <th>东帝汶</th>\n",
       "      <th>中非共和国</th>\n",
       "      <th>丹麦</th>\n",
       "      <th>乌克兰</th>\n",
       "      <th>乌兹别克斯坦</th>\n",
       "      <th>...</th>\n",
       "      <th>马恩岛</th>\n",
       "      <th>马拉维</th>\n",
       "      <th>马提尼克</th>\n",
       "      <th>马来西亚</th>\n",
       "      <th>马约特</th>\n",
       "      <th>马耳他</th>\n",
       "      <th>马达加斯加</th>\n",
       "      <th>马里</th>\n",
       "      <th>黎巴嫩</th>\n",
       "      <th>黑山</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>544.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>499.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>639.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>592.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>901.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>839.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-25</td>\n",
       "      <td>1377.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>1297.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>2076.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>1971.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>84225.0</td>\n",
       "      <td>77879.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1704.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>7242.0</td>\n",
       "      <td>5449.0</td>\n",
       "      <td>1495.0</td>\n",
       "      <td>...</td>\n",
       "      <td>285.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>151.0</td>\n",
       "      <td>2103.0</td>\n",
       "      <td>241.0</td>\n",
       "      <td>375.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>162.0</td>\n",
       "      <td>553.0</td>\n",
       "      <td>245.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>84239.0</td>\n",
       "      <td>77948.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1649.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>7384.0</td>\n",
       "      <td>5710.0</td>\n",
       "      <td>1543.0</td>\n",
       "      <td>...</td>\n",
       "      <td>287.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>151.0</td>\n",
       "      <td>2041.0</td>\n",
       "      <td>241.0</td>\n",
       "      <td>379.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>168.0</td>\n",
       "      <td>554.0</td>\n",
       "      <td>248.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>84278.0</td>\n",
       "      <td>78016.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1620.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>7515.0</td>\n",
       "      <td>6125.0</td>\n",
       "      <td>1565.0</td>\n",
       "      <td>...</td>\n",
       "      <td>293.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>151.0</td>\n",
       "      <td>2041.0</td>\n",
       "      <td>280.0</td>\n",
       "      <td>380.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>176.0</td>\n",
       "      <td>553.0</td>\n",
       "      <td>219.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>84294.0</td>\n",
       "      <td>78097.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1555.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>7695.0</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1657.0</td>\n",
       "      <td>...</td>\n",
       "      <td>293.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1987.0</td>\n",
       "      <td>280.0</td>\n",
       "      <td>384.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>187.0</td>\n",
       "      <td>552.0</td>\n",
       "      <td>207.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>84304.0</td>\n",
       "      <td>78169.0</td>\n",
       "      <td>4642.0</td>\n",
       "      <td>1493.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>7912.0</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1657.0</td>\n",
       "      <td>...</td>\n",
       "      <td>297.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1987.0</td>\n",
       "      <td>307.0</td>\n",
       "      <td>396.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>187.0</td>\n",
       "      <td>552.0</td>\n",
       "      <td>194.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 868 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countType   province_confirmedCount province_curedCount province_deadCount  \\\n",
       "countryName                      中国                  中国                 中国   \n",
       "2020-01-22                    544.0                28.0               17.0   \n",
       "2020-01-23                    639.0                30.0               17.0   \n",
       "2020-01-24                    901.0                36.0               26.0   \n",
       "2020-01-25                   1377.0                39.0               41.0   \n",
       "2020-01-26                   2076.0                49.0               56.0   \n",
       "...                             ...                 ...                ...   \n",
       "2020-04-19                  84225.0             77879.0             4642.0   \n",
       "2020-04-20                  84239.0             77948.0             4642.0   \n",
       "2020-04-21                  84278.0             78016.0             4642.0   \n",
       "2020-04-22                  84294.0             78097.0             4642.0   \n",
       "2020-04-23                  84304.0             78169.0             4642.0   \n",
       "\n",
       "countType   province_nowconfirmedCount province_confirmedCount              \\\n",
       "countryName                         中国                      不丹   东帝汶 中非共和国   \n",
       "2020-01-22                       499.0                     0.0   0.0   0.0   \n",
       "2020-01-23                       592.0                     0.0   0.0   0.0   \n",
       "2020-01-24                       839.0                     0.0   0.0   0.0   \n",
       "2020-01-25                      1297.0                     0.0   0.0   0.0   \n",
       "2020-01-26                      1971.0                     0.0   0.0   0.0   \n",
       "...                                ...                     ...   ...   ...   \n",
       "2020-04-19                      1704.0                     5.0  18.0  12.0   \n",
       "2020-04-20                      1649.0                     5.0  19.0  12.0   \n",
       "2020-04-21                      1620.0                     5.0  19.0  14.0   \n",
       "2020-04-22                      1555.0                     6.0  23.0  14.0   \n",
       "2020-04-23                      1493.0                     6.0  23.0  16.0   \n",
       "\n",
       "countType                            ... province_nowconfirmedCount        \\\n",
       "countryName      丹麦     乌克兰  乌兹别克斯坦  ...                        马恩岛   马拉维   \n",
       "2020-01-22      0.0     0.0     0.0  ...                        0.0   0.0   \n",
       "2020-01-23      0.0     0.0     0.0  ...                        0.0   0.0   \n",
       "2020-01-24      0.0     0.0     0.0  ...                        0.0   0.0   \n",
       "2020-01-25      0.0     0.0     0.0  ...                        0.0   0.0   \n",
       "2020-01-26      0.0     0.0     0.0  ...                        0.0   0.0   \n",
       "...             ...     ...     ...  ...                        ...   ...   \n",
       "2020-04-19   7242.0  5449.0  1495.0  ...                      285.0  15.0   \n",
       "2020-04-20   7384.0  5710.0  1543.0  ...                      287.0  15.0   \n",
       "2020-04-21   7515.0  6125.0  1565.0  ...                      293.0  15.0   \n",
       "2020-04-22   7695.0  6592.0  1657.0  ...                      293.0  18.0   \n",
       "2020-04-23   7912.0  6592.0  1657.0  ...                      297.0  18.0   \n",
       "\n",
       "countType                                                            \n",
       "countryName   马提尼克    马来西亚    马约特    马耳他 马达加斯加     马里    黎巴嫩     黑山  \n",
       "2020-01-22     0.0     0.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-23     0.0     0.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-24     0.0     0.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-25     0.0     0.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "2020-01-26     0.0     0.0    0.0    0.0   0.0    0.0    0.0    0.0  \n",
       "...            ...     ...    ...    ...   ...    ...    ...    ...  \n",
       "2020-04-19   151.0  2103.0  241.0  375.0  85.0  162.0  553.0  245.0  \n",
       "2020-04-20   151.0  2041.0  241.0  379.0  85.0  168.0  554.0  248.0  \n",
       "2020-04-21   151.0  2041.0  280.0  380.0  86.0  176.0  553.0  219.0  \n",
       "2020-04-22   149.0  1987.0  280.0  384.0  86.0  187.0  552.0  207.0  \n",
       "2020-04-23   149.0  1987.0  307.0  396.0  86.0  187.0  552.0  194.0  \n",
       "\n",
       "[93 rows x 868 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_world = pd.concat([dff_cn, dff_foreign], axis=1,sort=False)\n",
    "# df_world.iloc[0,:].fillna(0, inplace=True)\n",
    "# df_world.fillna(0, inplace=True)\n",
    "df_world.fillna(method='ffill', inplace=True)\n",
    "df_world.fillna(0, inplace=True)\n",
    "df_world"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### dff_world"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>countType</th>\n",
       "      <th>province_confirmedCount</th>\n",
       "      <th>province_curedCount</th>\n",
       "      <th>province_deadCount</th>\n",
       "      <th>province_nowconfirmedCount</th>\n",
       "      <th colspan=\"6\" halign=\"left\">province_confirmedCount</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">province_nowconfirmedCount</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>countryName</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>不丹</th>\n",
       "      <th>东帝汶</th>\n",
       "      <th>中非共和国</th>\n",
       "      <th>丹麦</th>\n",
       "      <th>乌克兰</th>\n",
       "      <th>乌兹别克斯坦</th>\n",
       "      <th>...</th>\n",
       "      <th>马恩岛</th>\n",
       "      <th>马拉维</th>\n",
       "      <th>马提尼克</th>\n",
       "      <th>马来西亚</th>\n",
       "      <th>马约特</th>\n",
       "      <th>马耳他</th>\n",
       "      <th>马达加斯加</th>\n",
       "      <th>马里</th>\n",
       "      <th>黎巴嫩</th>\n",
       "      <th>黑山</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>544</td>\n",
       "      <td>28</td>\n",
       "      <td>17</td>\n",
       "      <td>499</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>639</td>\n",
       "      <td>30</td>\n",
       "      <td>17</td>\n",
       "      <td>592</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>901</td>\n",
       "      <td>36</td>\n",
       "      <td>26</td>\n",
       "      <td>839</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-25</td>\n",
       "      <td>1377</td>\n",
       "      <td>39</td>\n",
       "      <td>41</td>\n",
       "      <td>1297</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>2076</td>\n",
       "      <td>49</td>\n",
       "      <td>56</td>\n",
       "      <td>1971</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>84225</td>\n",
       "      <td>77879</td>\n",
       "      <td>4642</td>\n",
       "      <td>1704</td>\n",
       "      <td>5</td>\n",
       "      <td>18</td>\n",
       "      <td>12</td>\n",
       "      <td>7242</td>\n",
       "      <td>5449</td>\n",
       "      <td>1495</td>\n",
       "      <td>...</td>\n",
       "      <td>285</td>\n",
       "      <td>15</td>\n",
       "      <td>151</td>\n",
       "      <td>2103</td>\n",
       "      <td>241</td>\n",
       "      <td>375</td>\n",
       "      <td>85</td>\n",
       "      <td>162</td>\n",
       "      <td>553</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>84239</td>\n",
       "      <td>77948</td>\n",
       "      <td>4642</td>\n",
       "      <td>1649</td>\n",
       "      <td>5</td>\n",
       "      <td>19</td>\n",
       "      <td>12</td>\n",
       "      <td>7384</td>\n",
       "      <td>5710</td>\n",
       "      <td>1543</td>\n",
       "      <td>...</td>\n",
       "      <td>287</td>\n",
       "      <td>15</td>\n",
       "      <td>151</td>\n",
       "      <td>2041</td>\n",
       "      <td>241</td>\n",
       "      <td>379</td>\n",
       "      <td>85</td>\n",
       "      <td>168</td>\n",
       "      <td>554</td>\n",
       "      <td>248</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>84278</td>\n",
       "      <td>78016</td>\n",
       "      <td>4642</td>\n",
       "      <td>1620</td>\n",
       "      <td>5</td>\n",
       "      <td>19</td>\n",
       "      <td>14</td>\n",
       "      <td>7515</td>\n",
       "      <td>6125</td>\n",
       "      <td>1565</td>\n",
       "      <td>...</td>\n",
       "      <td>293</td>\n",
       "      <td>15</td>\n",
       "      <td>151</td>\n",
       "      <td>2041</td>\n",
       "      <td>280</td>\n",
       "      <td>380</td>\n",
       "      <td>86</td>\n",
       "      <td>176</td>\n",
       "      <td>553</td>\n",
       "      <td>219</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>84294</td>\n",
       "      <td>78097</td>\n",
       "      <td>4642</td>\n",
       "      <td>1555</td>\n",
       "      <td>6</td>\n",
       "      <td>23</td>\n",
       "      <td>14</td>\n",
       "      <td>7695</td>\n",
       "      <td>6592</td>\n",
       "      <td>1657</td>\n",
       "      <td>...</td>\n",
       "      <td>293</td>\n",
       "      <td>18</td>\n",
       "      <td>149</td>\n",
       "      <td>1987</td>\n",
       "      <td>280</td>\n",
       "      <td>384</td>\n",
       "      <td>86</td>\n",
       "      <td>187</td>\n",
       "      <td>552</td>\n",
       "      <td>207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>84304</td>\n",
       "      <td>78169</td>\n",
       "      <td>4642</td>\n",
       "      <td>1493</td>\n",
       "      <td>6</td>\n",
       "      <td>23</td>\n",
       "      <td>16</td>\n",
       "      <td>7912</td>\n",
       "      <td>6592</td>\n",
       "      <td>1657</td>\n",
       "      <td>...</td>\n",
       "      <td>297</td>\n",
       "      <td>18</td>\n",
       "      <td>149</td>\n",
       "      <td>1987</td>\n",
       "      <td>307</td>\n",
       "      <td>396</td>\n",
       "      <td>86</td>\n",
       "      <td>187</td>\n",
       "      <td>552</td>\n",
       "      <td>194</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 868 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countType   province_confirmedCount province_curedCount province_deadCount  \\\n",
       "countryName                      中国                  中国                 中国   \n",
       "2020-01-22                      544                  28                 17   \n",
       "2020-01-23                      639                  30                 17   \n",
       "2020-01-24                      901                  36                 26   \n",
       "2020-01-25                     1377                  39                 41   \n",
       "2020-01-26                     2076                  49                 56   \n",
       "...                             ...                 ...                ...   \n",
       "2020-04-19                    84225               77879               4642   \n",
       "2020-04-20                    84239               77948               4642   \n",
       "2020-04-21                    84278               78016               4642   \n",
       "2020-04-22                    84294               78097               4642   \n",
       "2020-04-23                    84304               78169               4642   \n",
       "\n",
       "countType   province_nowconfirmedCount province_confirmedCount            \\\n",
       "countryName                         中国                      不丹 东帝汶 中非共和国   \n",
       "2020-01-22                         499                       0   0     0   \n",
       "2020-01-23                         592                       0   0     0   \n",
       "2020-01-24                         839                       0   0     0   \n",
       "2020-01-25                        1297                       0   0     0   \n",
       "2020-01-26                        1971                       0   0     0   \n",
       "...                                ...                     ...  ..   ...   \n",
       "2020-04-19                        1704                       5  18    12   \n",
       "2020-04-20                        1649                       5  19    12   \n",
       "2020-04-21                        1620                       5  19    14   \n",
       "2020-04-22                        1555                       6  23    14   \n",
       "2020-04-23                        1493                       6  23    16   \n",
       "\n",
       "countType                       ... province_nowconfirmedCount                 \\\n",
       "countryName    丹麦   乌克兰 乌兹别克斯坦  ...                        马恩岛 马拉维 马提尼克  马来西亚   \n",
       "2020-01-22      0     0      0  ...                          0   0    0     0   \n",
       "2020-01-23      0     0      0  ...                          0   0    0     0   \n",
       "2020-01-24      0     0      0  ...                          0   0    0     0   \n",
       "2020-01-25      0     0      0  ...                          0   0    0     0   \n",
       "2020-01-26      0     0      0  ...                          0   0    0     0   \n",
       "...           ...   ...    ...  ...                        ...  ..  ...   ...   \n",
       "2020-04-19   7242  5449   1495  ...                        285  15  151  2103   \n",
       "2020-04-20   7384  5710   1543  ...                        287  15  151  2041   \n",
       "2020-04-21   7515  6125   1565  ...                        293  15  151  2041   \n",
       "2020-04-22   7695  6592   1657  ...                        293  18  149  1987   \n",
       "2020-04-23   7912  6592   1657  ...                        297  18  149  1987   \n",
       "\n",
       "countType                                   \n",
       "countryName  马约特  马耳他 马达加斯加   马里  黎巴嫩   黑山  \n",
       "2020-01-22     0    0     0    0    0    0  \n",
       "2020-01-23     0    0     0    0    0    0  \n",
       "2020-01-24     0    0     0    0    0    0  \n",
       "2020-01-25     0    0     0    0    0    0  \n",
       "2020-01-26     0    0     0    0    0    0  \n",
       "...          ...  ...   ...  ...  ...  ...  \n",
       "2020-04-19   241  375    85  162  553  245  \n",
       "2020-04-20   241  379    85  168  554  248  \n",
       "2020-04-21   280  380    86  176  553  219  \n",
       "2020-04-22   280  384    86  187  552  207  \n",
       "2020-04-23   307  396    86  187  552  194  \n",
       "\n",
       "[93 rows x 868 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dff_world = df_world.astype(int)\n",
    "dff_world"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>countType</th>\n",
       "      <th>confirmedCount</th>\n",
       "      <th>curedCount</th>\n",
       "      <th>deadCount</th>\n",
       "      <th>nowconfirmedCount</th>\n",
       "      <th colspan=\"6\" halign=\"left\">confirmedCount</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">nowconfirmedCount</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>countryName</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>中国</th>\n",
       "      <th>不丹</th>\n",
       "      <th>东帝汶</th>\n",
       "      <th>中非共和国</th>\n",
       "      <th>丹麦</th>\n",
       "      <th>乌克兰</th>\n",
       "      <th>乌兹别克斯坦</th>\n",
       "      <th>...</th>\n",
       "      <th>马恩岛</th>\n",
       "      <th>马拉维</th>\n",
       "      <th>马提尼克</th>\n",
       "      <th>马来西亚</th>\n",
       "      <th>马约特</th>\n",
       "      <th>马耳他</th>\n",
       "      <th>马达加斯加</th>\n",
       "      <th>马里</th>\n",
       "      <th>黎巴嫩</th>\n",
       "      <th>黑山</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>544</td>\n",
       "      <td>28</td>\n",
       "      <td>17</td>\n",
       "      <td>499</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>639</td>\n",
       "      <td>30</td>\n",
       "      <td>17</td>\n",
       "      <td>592</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>901</td>\n",
       "      <td>36</td>\n",
       "      <td>26</td>\n",
       "      <td>839</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-25</td>\n",
       "      <td>1377</td>\n",
       "      <td>39</td>\n",
       "      <td>41</td>\n",
       "      <td>1297</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>2076</td>\n",
       "      <td>49</td>\n",
       "      <td>56</td>\n",
       "      <td>1971</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>84225</td>\n",
       "      <td>77879</td>\n",
       "      <td>4642</td>\n",
       "      <td>1704</td>\n",
       "      <td>5</td>\n",
       "      <td>18</td>\n",
       "      <td>12</td>\n",
       "      <td>7242</td>\n",
       "      <td>5449</td>\n",
       "      <td>1495</td>\n",
       "      <td>...</td>\n",
       "      <td>285</td>\n",
       "      <td>15</td>\n",
       "      <td>151</td>\n",
       "      <td>2103</td>\n",
       "      <td>241</td>\n",
       "      <td>375</td>\n",
       "      <td>85</td>\n",
       "      <td>162</td>\n",
       "      <td>553</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>84239</td>\n",
       "      <td>77948</td>\n",
       "      <td>4642</td>\n",
       "      <td>1649</td>\n",
       "      <td>5</td>\n",
       "      <td>19</td>\n",
       "      <td>12</td>\n",
       "      <td>7384</td>\n",
       "      <td>5710</td>\n",
       "      <td>1543</td>\n",
       "      <td>...</td>\n",
       "      <td>287</td>\n",
       "      <td>15</td>\n",
       "      <td>151</td>\n",
       "      <td>2041</td>\n",
       "      <td>241</td>\n",
       "      <td>379</td>\n",
       "      <td>85</td>\n",
       "      <td>168</td>\n",
       "      <td>554</td>\n",
       "      <td>248</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>84278</td>\n",
       "      <td>78016</td>\n",
       "      <td>4642</td>\n",
       "      <td>1620</td>\n",
       "      <td>5</td>\n",
       "      <td>19</td>\n",
       "      <td>14</td>\n",
       "      <td>7515</td>\n",
       "      <td>6125</td>\n",
       "      <td>1565</td>\n",
       "      <td>...</td>\n",
       "      <td>293</td>\n",
       "      <td>15</td>\n",
       "      <td>151</td>\n",
       "      <td>2041</td>\n",
       "      <td>280</td>\n",
       "      <td>380</td>\n",
       "      <td>86</td>\n",
       "      <td>176</td>\n",
       "      <td>553</td>\n",
       "      <td>219</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>84294</td>\n",
       "      <td>78097</td>\n",
       "      <td>4642</td>\n",
       "      <td>1555</td>\n",
       "      <td>6</td>\n",
       "      <td>23</td>\n",
       "      <td>14</td>\n",
       "      <td>7695</td>\n",
       "      <td>6592</td>\n",
       "      <td>1657</td>\n",
       "      <td>...</td>\n",
       "      <td>293</td>\n",
       "      <td>18</td>\n",
       "      <td>149</td>\n",
       "      <td>1987</td>\n",
       "      <td>280</td>\n",
       "      <td>384</td>\n",
       "      <td>86</td>\n",
       "      <td>187</td>\n",
       "      <td>552</td>\n",
       "      <td>207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>84304</td>\n",
       "      <td>78169</td>\n",
       "      <td>4642</td>\n",
       "      <td>1493</td>\n",
       "      <td>6</td>\n",
       "      <td>23</td>\n",
       "      <td>16</td>\n",
       "      <td>7912</td>\n",
       "      <td>6592</td>\n",
       "      <td>1657</td>\n",
       "      <td>...</td>\n",
       "      <td>297</td>\n",
       "      <td>18</td>\n",
       "      <td>149</td>\n",
       "      <td>1987</td>\n",
       "      <td>307</td>\n",
       "      <td>396</td>\n",
       "      <td>86</td>\n",
       "      <td>187</td>\n",
       "      <td>552</td>\n",
       "      <td>194</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 868 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countType   confirmedCount curedCount deadCount nowconfirmedCount  \\\n",
       "countryName             中国         中国        中国                中国   \n",
       "2020-01-22             544         28        17               499   \n",
       "2020-01-23             639         30        17               592   \n",
       "2020-01-24             901         36        26               839   \n",
       "2020-01-25            1377         39        41              1297   \n",
       "2020-01-26            2076         49        56              1971   \n",
       "...                    ...        ...       ...               ...   \n",
       "2020-04-19           84225      77879      4642              1704   \n",
       "2020-04-20           84239      77948      4642              1649   \n",
       "2020-04-21           84278      78016      4642              1620   \n",
       "2020-04-22           84294      78097      4642              1555   \n",
       "2020-04-23           84304      78169      4642              1493   \n",
       "\n",
       "countType   confirmedCount                               ...  \\\n",
       "countryName             不丹 东帝汶 中非共和国    丹麦   乌克兰 乌兹别克斯坦  ...   \n",
       "2020-01-22               0   0     0     0     0      0  ...   \n",
       "2020-01-23               0   0     0     0     0      0  ...   \n",
       "2020-01-24               0   0     0     0     0      0  ...   \n",
       "2020-01-25               0   0     0     0     0      0  ...   \n",
       "2020-01-26               0   0     0     0     0      0  ...   \n",
       "...                    ...  ..   ...   ...   ...    ...  ...   \n",
       "2020-04-19               5  18    12  7242  5449   1495  ...   \n",
       "2020-04-20               5  19    12  7384  5710   1543  ...   \n",
       "2020-04-21               5  19    14  7515  6125   1565  ...   \n",
       "2020-04-22               6  23    14  7695  6592   1657  ...   \n",
       "2020-04-23               6  23    16  7912  6592   1657  ...   \n",
       "\n",
       "countType   nowconfirmedCount                                                \n",
       "countryName               马恩岛 马拉维 马提尼克  马来西亚  马约特  马耳他 马达加斯加   马里  黎巴嫩   黑山  \n",
       "2020-01-22                  0   0    0     0    0    0     0    0    0    0  \n",
       "2020-01-23                  0   0    0     0    0    0     0    0    0    0  \n",
       "2020-01-24                  0   0    0     0    0    0     0    0    0    0  \n",
       "2020-01-25                  0   0    0     0    0    0     0    0    0    0  \n",
       "2020-01-26                  0   0    0     0    0    0     0    0    0    0  \n",
       "...                       ...  ..  ...   ...  ...  ...   ...  ...  ...  ...  \n",
       "2020-04-19                285  15  151  2103  241  375    85  162  553  245  \n",
       "2020-04-20                287  15  151  2041  241  379    85  168  554  248  \n",
       "2020-04-21                293  15  151  2041  280  380    86  176  553  219  \n",
       "2020-04-22                293  18  149  1987  280  384    86  187  552  207  \n",
       "2020-04-23                297  18  149  1987  307  396    86  187  552  194  \n",
       "\n",
       "[93 rows x 868 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simple_world_columns = [[i[0].replace('province_', '') for i in dff_world.columns], \n",
    "                        [i[1] for i in dff_world.columns]]\n",
    "dff_world.columns = simple_world_columns\n",
    "dff_world.columns.names = ['countType', 'countryName']\n",
    "dff_world"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "#     dff_world.index.names = ['date']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "# dff_world.to_csv('dff_world.csv')\n",
    "# dff_world_r = pd.read_csv('dff_world.csv', names=dff_world.columns)\n",
    "# dff_world_r"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### func melt_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "dff_world['confirmedCount'].melt(value_name='confirmedCount')\n",
    "def melt_data(column):\n",
    "    df = dff_world[column]\n",
    "    df['date'] = df.index\n",
    "    dff = df.melt( id_vars='date',value_name=column)\n",
    "    return dff\n",
    "# melt_data(column='nowconfirmedCount')\n",
    "# melt_data_ls = [melt_data(c) for c in ['confirmedCount', 'nowconfirmedCount', 'curedCount', 'deadCount']]\n",
    "# dff_world_melt = pd.concat(melt_data_ls, axis=1)\n",
    "# dff_world_melt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### merge_all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "F:\\Anaconda\\lib\\site-packages\\ipykernel_launcher.py:4: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  after removing the cwd from sys.path.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>countryName</th>\n",
       "      <th>confirmedCount</th>\n",
       "      <th>nowconfirmedCount</th>\n",
       "      <th>curedCount</th>\n",
       "      <th>deadCount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>中国</td>\n",
       "      <td>544</td>\n",
       "      <td>499</td>\n",
       "      <td>28</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12090</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>毛里塔尼亚</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3069</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>匈牙利</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17112</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>荷属圣马丁</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15810</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>缅甸</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9299</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>布基纳法索</td>\n",
       "      <td>609</td>\n",
       "      <td>181</td>\n",
       "      <td>389</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4742</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>吉尔吉斯斯坦</td>\n",
       "      <td>612</td>\n",
       "      <td>404</td>\n",
       "      <td>201</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13484</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>海地</td>\n",
       "      <td>57</td>\n",
       "      <td>54</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17669</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>蒙古</td>\n",
       "      <td>34</td>\n",
       "      <td>29</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20180</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>黑山</td>\n",
       "      <td>315</td>\n",
       "      <td>194</td>\n",
       "      <td>116</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20181 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             date countryName  confirmedCount  nowconfirmedCount  curedCount  \\\n",
       "0      2020-01-22          中国             544                499          28   \n",
       "12090  2020-01-22       毛里塔尼亚               0                  0           0   \n",
       "3069   2020-01-22         匈牙利               0                  0           0   \n",
       "17112  2020-01-22       荷属圣马丁               0                  0           0   \n",
       "15810  2020-01-22          缅甸               0                  0           0   \n",
       "...           ...         ...             ...                ...         ...   \n",
       "9299   2020-04-23       布基纳法索             609                181         389   \n",
       "4742   2020-04-23      吉尔吉斯斯坦             612                404         201   \n",
       "13484  2020-04-23          海地              57                 54           0   \n",
       "17669  2020-04-23          蒙古              34                 29           5   \n",
       "20180  2020-04-23          黑山             315                194         116   \n",
       "\n",
       "       deadCount  \n",
       "0             17  \n",
       "12090          0  \n",
       "3069           0  \n",
       "17112          0  \n",
       "15810          0  \n",
       "...          ...  \n",
       "9299          39  \n",
       "4742           7  \n",
       "13484          3  \n",
       "17669          0  \n",
       "20180          5  \n",
       "\n",
       "[20181 rows x 6 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "melt_data_confirmed = melt_data(column='confirmedCount')\n",
    "melt_data_nowconfirmed = melt_data(column='nowconfirmedCount')\n",
    "melt_data_cured = melt_data(column='curedCount')\n",
    "melt_data_dead = melt_data(column='deadCount')\n",
    "\n",
    "merge_con_nowcon = pd.merge(left=melt_data_confirmed, right=melt_data_nowconfirmed, on=['date', 'countryName'])\n",
    "merge_cured_dead = pd.merge(left=melt_data_cured, right=melt_data_dead, on=['date', 'countryName'])\n",
    "merge_all = pd.merge(left=merge_con_nowcon, right=merge_cured_dead, on=['date', 'countryName'])\n",
    "merge_all.sort_values(by='date', inplace=True)\n",
    "merge_all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# merge_all['countryName'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_countryNameDiff = pd.read_excel('ccname.xlsx', sheet_name='Sheet3')\n",
    "countryNameDict = dict(zip(df_area['countryName'], df_area['countryEnglishName']))\n",
    "countryNameDictDiff = dict(zip(df_countryNameDiff['cn'], df_countryNameDiff['en']))\n",
    "def new_countryEnName(name):\n",
    "    if name in countryNameDictDiff:\n",
    "        return countryNameDictDiff[name]\n",
    "    return countryNameDict[name]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## dff_area"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>countryName</th>\n",
       "      <th>confirmedCount</th>\n",
       "      <th>nowconfirmedCount</th>\n",
       "      <th>curedCount</th>\n",
       "      <th>deadCount</th>\n",
       "      <th>countryShortEnglishName</th>\n",
       "      <th>countryEnglishName</th>\n",
       "      <th>deadRate</th>\n",
       "      <th>curedRate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>中国</td>\n",
       "      <td>544</td>\n",
       "      <td>499</td>\n",
       "      <td>28</td>\n",
       "      <td>17</td>\n",
       "      <td>China</td>\n",
       "      <td>China</td>\n",
       "      <td>3.125000</td>\n",
       "      <td>5.147059</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>毛里塔尼亚</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Mauritania</td>\n",
       "      <td>The Islamic Republic of Mauritania</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>匈牙利</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Hungary</td>\n",
       "      <td>Hungary</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>荷属圣马丁</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>not value</td>\n",
       "      <td>not value</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>缅甸</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Myanmar</td>\n",
       "      <td>Burma</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20176</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>布基纳法索</td>\n",
       "      <td>609</td>\n",
       "      <td>181</td>\n",
       "      <td>389</td>\n",
       "      <td>39</td>\n",
       "      <td>Burkina Faso</td>\n",
       "      <td>Burkina Faso</td>\n",
       "      <td>6.403941</td>\n",
       "      <td>63.875205</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20177</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>吉尔吉斯斯坦</td>\n",
       "      <td>612</td>\n",
       "      <td>404</td>\n",
       "      <td>201</td>\n",
       "      <td>7</td>\n",
       "      <td>Kyrgyzstan</td>\n",
       "      <td>not value</td>\n",
       "      <td>1.143791</td>\n",
       "      <td>32.843137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20178</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>海地</td>\n",
       "      <td>57</td>\n",
       "      <td>54</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Haiti</td>\n",
       "      <td>Haiti</td>\n",
       "      <td>5.263158</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20179</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>蒙古</td>\n",
       "      <td>34</td>\n",
       "      <td>29</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>Mongolia</td>\n",
       "      <td>Mongolia</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>14.705882</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20180</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>黑山</td>\n",
       "      <td>315</td>\n",
       "      <td>194</td>\n",
       "      <td>116</td>\n",
       "      <td>5</td>\n",
       "      <td>Montenegro</td>\n",
       "      <td>not value</td>\n",
       "      <td>1.587302</td>\n",
       "      <td>36.825397</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20181 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             date countryName  confirmedCount  nowconfirmedCount  curedCount  \\\n",
       "0      2020-01-22          中国             544                499          28   \n",
       "1      2020-01-22       毛里塔尼亚               0                  0           0   \n",
       "2      2020-01-22         匈牙利               0                  0           0   \n",
       "3      2020-01-22       荷属圣马丁               0                  0           0   \n",
       "4      2020-01-22          缅甸               0                  0           0   \n",
       "...           ...         ...             ...                ...         ...   \n",
       "20176  2020-04-23       布基纳法索             609                181         389   \n",
       "20177  2020-04-23      吉尔吉斯斯坦             612                404         201   \n",
       "20178  2020-04-23          海地              57                 54           0   \n",
       "20179  2020-04-23          蒙古              34                 29           5   \n",
       "20180  2020-04-23          黑山             315                194         116   \n",
       "\n",
       "       deadCount countryShortEnglishName                  countryEnglishName  \\\n",
       "0             17                   China                               China   \n",
       "1              0              Mauritania  The Islamic Republic of Mauritania   \n",
       "2              0                 Hungary                             Hungary   \n",
       "3              0               not value                           not value   \n",
       "4              0                 Myanmar                               Burma   \n",
       "...          ...                     ...                                 ...   \n",
       "20176         39            Burkina Faso                        Burkina Faso   \n",
       "20177          7              Kyrgyzstan                           not value   \n",
       "20178          3                   Haiti                               Haiti   \n",
       "20179          0                Mongolia                            Mongolia   \n",
       "20180          5              Montenegro                           not value   \n",
       "\n",
       "       deadRate  curedRate  \n",
       "0      3.125000   5.147059  \n",
       "1           NaN        NaN  \n",
       "2           NaN        NaN  \n",
       "3           NaN        NaN  \n",
       "4           NaN        NaN  \n",
       "...         ...        ...  \n",
       "20176  6.403941  63.875205  \n",
       "20177  1.143791  32.843137  \n",
       "20178  5.263158   0.000000  \n",
       "20179  0.000000  14.705882  \n",
       "20180  1.587302  36.825397  \n",
       "\n",
       "[20181 rows x 10 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# merge_all['countryEnglishName'] = merge_all['countryName'].apply(lambda x: countryNameDict.get(x))\n",
    "# merge_all\n",
    "dff_area = merge_all.reset_index().drop(columns=['index'])\n",
    "dff_area['countryShortEnglishName'] = dff_area['countryName'].apply(new_countryEnName)\n",
    "dff_area['countryEnglishName'] = dff_area['countryName'].apply(lambda x: countryNameDict[x])\n",
    "dff_area.fillna('not value', inplace=True)\n",
    "dff_area['deadRate'] = dff_area['deadCount'] / dff_area['confirmedCount'] * 100\n",
    "dff_area['curedRate'] = dff_area['curedCount'] / dff_area['confirmedCount'] *100\n",
    "dff_area"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "dff_area.to_csv('DXYAreaSimple.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### world_map_tap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\wangw\\\\Desktop\\\\JupytertNotebookFile\\\\world_tab.html'"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Map, Timeline, Line, Tab\n",
    "from pyecharts import options as opts\n",
    "def get_world_map_all(label, column, pieces_type):\n",
    "    tl = Timeline(init_opts=opts.InitOpts(width='1500px', height='700px'))\n",
    "    \n",
    "    tl.add_schema(play_interval=1000)\n",
    "    \n",
    "    for target_date in dff_area['date'].unique():\n",
    "        confirm_map =  Map()\n",
    "        df_world = dff_area[dff_area['date']==target_date].sort_values(by=column, ascending=False)\n",
    "        df_world_10 = df_world[df_world[column] > 0].head(30)\n",
    "#         subtitle_info = '\\n'.join([f\"{j+1}. {i[0]}: {i[1]:,.0f}\" for j,i in enumerate(zip(df_world_10['countryName'], df_world_10[column]))])\n",
    "\n",
    "        subtitle_info = '\\n'.join([f\"{i[0]}: {i[1]:,.0f}\" for i in zip(df_world_10['countryName'], df_world_10[column])])\n",
    "        if column == 'deadCount':\n",
    "            subtitle_info = '\\n'.join([f\"{i[0]}: {i[1]:,.0f} ({i[2]:.2f}%)\" for i in zip(df_world_10['countryName'], df_world_10[column], df_world_10['deadRate'])])\n",
    "        if column == 'curedCount':\n",
    "            subtitle_info = '\\n'.join([f\"{i[0]}: {i[1]:,.0f} ({i[2]:.2f}%)\" for i in zip(df_world_10['countryName'], df_world_10[column], df_world_10['curedRate'])])                \n",
    "        titles = f\"{target_date[-5:]} {label}病例: {df_world[column].sum():,.0f}人\\n\\n{subtitle_info}\"\n",
    "        confirm_map.add(label, \n",
    "                    [list(z) for z in zip(df_world['countryShortEnglishName'], df_world[column].tolist() )], \n",
    "                    \"world\",label_opts=opts.LabelOpts(is_show=False),is_map_symbol_show=False,\n",
    "                  )\n",
    "\n",
    "        confirm_map.set_global_opts(\n",
    "            title_opts=opts.TitleOpts(title=titles,\n",
    "                                      pos_left='right',\n",
    "                                      ), \n",
    "            legend_opts = opts.LegendOpts(pos_bottom='15%', pos_left='40%', is_show=False),\n",
    "        \n",
    "            visualmap_opts=opts.VisualMapOpts(is_piecewise=True, \n",
    "                                             pieces=pieces_type, \n",
    "                                             pos_bottom='10%',\n",
    "                                             pos_left='15%')\n",
    "        )\n",
    "        tl.add(confirm_map, target_date)  \n",
    "    return tl\n",
    "pieces_confirm = [{'min': 100000, 'color': '#4F070D'},\n",
    "                  {'min':50000, \"max\": 99999, 'color': '#811C24'},\n",
    "                  {'min':10000, \"max\": 49999, 'color': '#CB2A2F'},\n",
    "                  {'min':1000, \"max\": 9999, 'color': '#E55A4E' },\n",
    "                  {'min':100, \"max\": 999, 'color': '#F59E83'},\n",
    "                  {'min':1, \"max\": 99, 'color': '#FDEBCF'},\n",
    "                  {'max':0, 'color': '#FFFFFF', 'label': '0'}]\n",
    "pieces_cured = [{'min': 10000, 'color': '#25BB00'},\n",
    "                {'min':1000, \"max\": 9999, 'color': '#33FF00'},\n",
    "                {'min':500, \"max\": 999, 'color': '#5CFF33'},\n",
    "                {'min':100, \"max\": 499, 'color': '#92FF77' },\n",
    "                {'min':10, \"max\": 99, 'color': '#D6FFCC'},\n",
    "                {'min':1, \"max\": 9, 'color': '#E4FFDD'},\n",
    "                {'max':0, 'color': '#FFFFFF', 'label': '0'}]\n",
    "pieces_dead = [{'min': 10000, 'color': '#4F070D'},\n",
    "                {'min':1000, \"max\": 9999, 'color': '#811C24'},\n",
    "                {'min':500, \"max\": 999, 'color': '#CB2A2F'},\n",
    "                {'min':100, \"max\": 499, 'color': '#E55A4E' },\n",
    "                {'min':10, \"max\": 99, 'color': '#F59E83'},\n",
    "                {'min':1, \"max\": 9, 'color': '#FDEBCF'},\n",
    "                {'max':0, 'color': '#FFFFFF', 'label': '0'}]\n",
    "\n",
    "world_tab = Tab()\n",
    "world_tab.add(get_world_map_all(label='现有确诊', column='nowconfirmedCount', pieces_type=pieces_confirm), '世界现有确诊病例疫情图')\n",
    "world_tab.add(get_world_map_all(label='累计确诊', column='confirmedCount', pieces_type=pieces_confirm), '世界累计确诊病例疫情图')\n",
    "world_tab.add(get_world_map_all(label='累计治愈', column='curedCount', pieces_type=pieces_cured), '世界累计治愈病例疫情图')\n",
    "world_tab.add(get_world_map_all(label='累计死亡', column='deadCount', pieces_type=pieces_dead), '世界累计死亡病例疫情图')\n",
    "world_tab.render('世界疫情地图.html')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "# country = '美国'\n",
    "# column = 'confirmedCount'\n",
    "# dff_area[dff_area['countryName'] == country][[column]].diff()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>countryName</th>\n",
       "      <th>美国</th>\n",
       "      <th>英国</th>\n",
       "      <th>意大利</th>\n",
       "      <th>西班牙</th>\n",
       "      <th>土耳其</th>\n",
       "      <th>俄罗斯</th>\n",
       "      <th>法国</th>\n",
       "      <th>德国</th>\n",
       "      <th>荷兰</th>\n",
       "      <th>比利时</th>\n",
       "      <th>加拿大</th>\n",
       "      <th>葡萄牙</th>\n",
       "      <th>巴西</th>\n",
       "      <th>伊朗</th>\n",
       "      <th>印度</th>\n",
       "      <th>瑞典</th>\n",
       "      <th>秘鲁</th>\n",
       "      <th>沙特阿拉伯</th>\n",
       "      <th>日本</th>\n",
       "      <th>墨西哥</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>2020-01-22</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-19</td>\n",
       "      <td>629417</td>\n",
       "      <td>103663</td>\n",
       "      <td>107771</td>\n",
       "      <td>98134</td>\n",
       "      <td>69986</td>\n",
       "      <td>39201</td>\n",
       "      <td>56515</td>\n",
       "      <td>47603</td>\n",
       "      <td>28680</td>\n",
       "      <td>24056</td>\n",
       "      <td>22687</td>\n",
       "      <td>18882</td>\n",
       "      <td>20527</td>\n",
       "      <td>20070</td>\n",
       "      <td>13295</td>\n",
       "      <td>12905</td>\n",
       "      <td>7388</td>\n",
       "      <td>7867</td>\n",
       "      <td>9809</td>\n",
       "      <td>6846</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-20</td>\n",
       "      <td>648857</td>\n",
       "      <td>107890</td>\n",
       "      <td>108257</td>\n",
       "      <td>98771</td>\n",
       "      <td>72313</td>\n",
       "      <td>43270</td>\n",
       "      <td>56310</td>\n",
       "      <td>45768</td>\n",
       "      <td>29363</td>\n",
       "      <td>25398</td>\n",
       "      <td>21938</td>\n",
       "      <td>19518</td>\n",
       "      <td>14530</td>\n",
       "      <td>19023</td>\n",
       "      <td>14255</td>\n",
       "      <td>12714</td>\n",
       "      <td>8417</td>\n",
       "      <td>8891</td>\n",
       "      <td>9822</td>\n",
       "      <td>7574</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-21</td>\n",
       "      <td>672929</td>\n",
       "      <td>111363</td>\n",
       "      <td>107709</td>\n",
       "      <td>100382</td>\n",
       "      <td>75410</td>\n",
       "      <td>48434</td>\n",
       "      <td>56983</td>\n",
       "      <td>43659</td>\n",
       "      <td>29927</td>\n",
       "      <td>25956</td>\n",
       "      <td>23068</td>\n",
       "      <td>19700</td>\n",
       "      <td>15235</td>\n",
       "      <td>18540</td>\n",
       "      <td>15122</td>\n",
       "      <td>13041</td>\n",
       "      <td>8912</td>\n",
       "      <td>9882</td>\n",
       "      <td>10193</td>\n",
       "      <td>8059</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-22</td>\n",
       "      <td>705352</td>\n",
       "      <td>115051</td>\n",
       "      <td>107709</td>\n",
       "      <td>100757</td>\n",
       "      <td>78414</td>\n",
       "      <td>53066</td>\n",
       "      <td>57347</td>\n",
       "      <td>41415</td>\n",
       "      <td>30497</td>\n",
       "      <td>26193</td>\n",
       "      <td>23400</td>\n",
       "      <td>20054</td>\n",
       "      <td>16013</td>\n",
       "      <td>17492</td>\n",
       "      <td>15859</td>\n",
       "      <td>13517</td>\n",
       "      <td>10371</td>\n",
       "      <td>10851</td>\n",
       "      <td>10229</td>\n",
       "      <td>8643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>719225</td>\n",
       "      <td>115051</td>\n",
       "      <td>107699</td>\n",
       "      <td>101617</td>\n",
       "      <td>79821</td>\n",
       "      <td>57327</td>\n",
       "      <td>57154</td>\n",
       "      <td>39652</td>\n",
       "      <td>30497</td>\n",
       "      <td>26507</td>\n",
       "      <td>24231</td>\n",
       "      <td>20054</td>\n",
       "      <td>17533</td>\n",
       "      <td>16702</td>\n",
       "      <td>16454</td>\n",
       "      <td>13689</td>\n",
       "      <td>11693</td>\n",
       "      <td>10851</td>\n",
       "      <td>10655</td>\n",
       "      <td>9573</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "countryName      美国      英国     意大利     西班牙    土耳其    俄罗斯     法国     德国  \\\n",
       "2020-01-22        0       0       0       0      0      0      0      0   \n",
       "2020-01-23        0       0       0       0      0      0      0      0   \n",
       "2020-01-24        0       0       0       0      0      0      0      0   \n",
       "2020-01-25        0       0       0       0      0      0      0      0   \n",
       "2020-01-26        0       0       0       0      0      0      0      0   \n",
       "...             ...     ...     ...     ...    ...    ...    ...    ...   \n",
       "2020-04-19   629417  103663  107771   98134  69986  39201  56515  47603   \n",
       "2020-04-20   648857  107890  108257   98771  72313  43270  56310  45768   \n",
       "2020-04-21   672929  111363  107709  100382  75410  48434  56983  43659   \n",
       "2020-04-22   705352  115051  107709  100757  78414  53066  57347  41415   \n",
       "2020-04-23   719225  115051  107699  101617  79821  57327  57154  39652   \n",
       "\n",
       "countryName     荷兰    比利时    加拿大    葡萄牙     巴西     伊朗     印度     瑞典     秘鲁  \\\n",
       "2020-01-22       0      0      0      0      0      0      0      0      0   \n",
       "2020-01-23       0      0      0      0      0      0      0      0      0   \n",
       "2020-01-24       0      0      0      0      0      0      0      0      0   \n",
       "2020-01-25       0      0      0      0      0      0      0      0      0   \n",
       "2020-01-26       0      0      0      0      0      0      0      0      0   \n",
       "...            ...    ...    ...    ...    ...    ...    ...    ...    ...   \n",
       "2020-04-19   28680  24056  22687  18882  20527  20070  13295  12905   7388   \n",
       "2020-04-20   29363  25398  21938  19518  14530  19023  14255  12714   8417   \n",
       "2020-04-21   29927  25956  23068  19700  15235  18540  15122  13041   8912   \n",
       "2020-04-22   30497  26193  23400  20054  16013  17492  15859  13517  10371   \n",
       "2020-04-23   30497  26507  24231  20054  17533  16702  16454  13689  11693   \n",
       "\n",
       "countryName  沙特阿拉伯     日本   墨西哥  \n",
       "2020-01-22       0      0     0  \n",
       "2020-01-23       0      0     0  \n",
       "2020-01-24       0      0     0  \n",
       "2020-01-25       0      0     0  \n",
       "2020-01-26       0      0     0  \n",
       "...            ...    ...   ...  \n",
       "2020-04-19    7867   9809  6846  \n",
       "2020-04-20    8891   9822  7574  \n",
       "2020-04-21    9882  10193  8059  \n",
       "2020-04-22   10851  10229  8643  \n",
       "2020-04-23   10851  10655  9573  \n",
       "\n",
       "[93 rows x 20 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dff_now = dff_world['nowconfirmedCount'].sort_values(by=dff_world.index[-1], axis=1, ascending=False).iloc[:, :20]\n",
    "dff_now"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\wangw\\\\Desktop\\\\JupytertNotebookFile\\\\20 foreign counttry line nowconfirmed.html'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def line_province(): \n",
    "    dff_province_t = dff_now\n",
    "    dates = [i[5:] for i in dff_province_t.index]\n",
    "    global_setting = dict(datazoom_opts = [opts.DataZoomOpts(type_='inside'), opts.DataZoomOpts()],\n",
    "        legend_opts= opts.LegendOpts(pos_top=30),\n",
    "        yaxis_opts= opts.AxisOpts(axislabel_opts=opts.LabelOpts(formatter=\"{value} 人\"), \n",
    "                                  splitline_opts=opts.SplitLineOpts(is_show=True)),\n",
    "        xaxis_opts= opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=60)),\n",
    "        tooltip_opts = opts.TooltipOpts(axis_pointer_type='cross'))\n",
    "\n",
    "    line = Line(init_opts=opts.InitOpts(width='1500px', height='700px'))\n",
    "    line.add_xaxis(list(dates))\n",
    "    for p in dff_province_t.columns:\n",
    "        line.add_yaxis(p, dff_province_t[p],label_opts=opts.LabelOpts(is_show=False),is_selected=False, is_smooth=True)\n",
    "#     line.add_yaxis(\"死亡病例\", deadCount,color='gray', label_opts=opts.LabelOpts(is_show=False))\n",
    "#     line.add_yaxis(\"治愈病例\", healCount,color='orange',label_opts=opts.LabelOpts(is_show=False))\n",
    "\n",
    "\n",
    "#     line.set_colors(['red', 'gray', 'green'])\n",
    "    line.set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Line-世界现有确诊病例前20国趋势线\", \n",
    "                                  subtitle=f\"Date: {list(dates)[-1]}\"),\n",
    "        **global_setting)\n",
    "#     line.set_series_opts(\n",
    "#     markline_opts=opts.MarkLineOpts(\n",
    "#             data=[opts.MarkLineItem(y=80000, name=\"China\")]),)\n",
    "    return line\n",
    "line_province().render('世界现有确诊病例前20国趋势线.html')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "307.2px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}